package com.incar.chuxing.adapter;

import android.content.Context;

import com.incar.chuxing.R;
import com.incar.chuxing.base.BaseRcAdapterHelper;
import com.incar.chuxing.base.RcQuickAdapter;
import com.incar.chuxing.bean.SettlementDetailBean;
import com.incar.chuxing.utils.TimeUtils;

/**
 * Created by Michael on 2016/10/19.
 */
public class ChooseCouponAdapter extends RcQuickAdapter<SettlementDetailBean.AttachmentBean.CouponsBean> {
    public ChooseCouponAdapter(Context context, int layoutResId) {
        super(context, layoutResId);
    }

    @Override
    protected void convert(BaseRcAdapterHelper helper, SettlementDetailBean.AttachmentBean.CouponsBean item) {
        if (item.getType() == 0) {
            helper.getImageView(R.id.coupon_left).setImageResource(R.drawable.coupon_car);
        } else if (item.getType() == 1) {
            helper.getImageView(R.id.coupon_left).setImageResource(R.drawable.coupon_car);
        }
        helper.setText(R.id.coupon_price, "" + (int) item.getDenomination());
        helper.setText(R.id.coupon_title, item.getTitle());
        helper.setText(R.id.coupon_content, item.getContent());
        helper.setText(R.id.coupon_fromData, TimeUtils.getFormatDate(item.getStartDate() + "", "yyyy-MM-dd"));
        helper.setText(R.id.coupon_endData, "至" + TimeUtils.getFormatDate(item.getEndDate() + "", "yyyy-MM-dd"));
    }
}
